package icu.lookyousmileface.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author starrysky
 * @title: SqlController
 * @projectName spring_data
 * @description: controller layer
 * @date 2021/2/817:18
 */
@RestController
public class SqlController {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @GetMapping("/all")
    public List<Map<String, Object>> selectAll(){
        String sql = "select * from mybatis_plus.user";
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
        return maps;
    }
}
